package com.gack.business.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.gack.business.model.UserEnterpriseDepartmentRole;

@Repository
public interface UserEnterpriseDepartmentRoleRepository extends JpaRepository<UserEnterpriseDepartmentRole, String>,
		JpaSpecificationExecutor<UserEnterpriseDepartmentRole> {

	@Query("select roleId from UserEnterpriseDepartmentRole where userId = :userId and enterpriseId= :enterpriseId and departmentId =:departmentId")
	String findRoleIdByUserIdAndEnterpriseIdAndDepartmentId(@Param("userId")String userId,@Param("enterpriseId")String enterpriseId,@Param("departmentId")String departmentId);

	@Query("select roleId from UserEnterpriseDepartmentRole where userId = :userId and enterpriseId= :enterpriseId")
	String findRoleIdByUserIdAndEnterpriseId(@Param("userId")String userId,@Param("enterpriseId")String enterpriseId);

	
}
